<?php

//TODO lägga till så att den tar undantagstid om det finn ett undantag innan standard.
class OpeningTimes_model extends CI_Model
{
	function GetEndRentalTime($date)
	{

		$sqlCommand="select endTime from studentbilar.openingtimes where day = date_format(?,'%W') order by endTime asc";		
		$result=$this->db->query($sqlCommand,array($date));
		return $result->result_array();
	
	}	
	
	function GetStartRentalTime($date)
	{

		$sqlCommand="select startTime from studentbilar.openingtimes where day = date_format(?,'%W') order by endTime asc";		
		$result=$this->db->query($sqlCommand,array($date));
		return $result->result_array();
	
	}
	
	function GetRentalTime($date)
	{
		$sqlCommand="select startTime,endTime from studentbilar.openingtimes where day = date_format(?,'%W') order by endTime asc";		
		$result=$this->db->query($sqlCommand,array($date));
		return $result->result_array();
	}

}	

